# 导包
import time
import unittest
from tools.HTMLTestRunner import HTMLTestRunner

# 组装测试套件
suite = unittest.defaultTestLoader.discover("./case", pattern="test*.py")

# 使用 time.strftime() 格式化时间/指定报告存放路径
file_path = "./report/{}.html".format(time.strftime("%Y_%m_%d_%H_%M_%S"))
print(file_path)

# 运行套件并生成报告
with open(file_path, "wb") as f:
    HTMLTestRunner(stream=f).run(suite)
